home *** CD-ROM | disk | FTP | other *** search
/ HTBasic 9.3 / HTBasic 9.3.iso / LgcyPlus / disk2 / EMLVL0._ / EMLVL0.
Encoding:
Text File  |  2001-03-02  |  1.7 KB  |  45 lines

  1. 10    ! ********************************************************
  2. 20    ! Example: Engine Monitor - Level-0 Widgets
  3. 30    !
  4. 40    ! This program displays a simulated engine monitor for
  5. 50    ! a theoretical engine. Torque, pressure, and dwell are
  6. 60    ! displayed, as well as a Status Log.
  7. 70    !
  8. 80    ! ********************************************************
  9. 90    !
  10. 100   DIM Buf$[200]
  11. 110   !
  12. 120   ! Create the widgets
  13. 130   !
  14. 140   ASSIGN @Meter1 TO WIDGET "METER";SET ("X":200,"Y":10,"WIDTH":150,"HEIGHT":175,"TITLE":"Torque","ARC WIDTH":3)
  15. 150   ASSIGN @Bars1 TO WIDGET "BARS";SET ("X":375,"Y":10,"WIDTH":150,"HEIGHT":250,"TITLE":"Pressure","SHOW LIMITS":0)
  16. 160   ASSIGN @Dispdwell TO WIDGET "LABEL";SET ("X":200,"Y":200,"WIDTH":150,"HEIGHT":60,"TITLE":"Dwell")
  17. 170   ASSIGN @Logtext TO WIDGET "PRINTER";SET ("X":200,"Y":275,"WIDTH":325,"HEIGHT":100,"TITLE":"Status Log")
  18. 180   ASSIGN @Label TO WIDGET "LABEL"
  19. 190   CONTROL @Label;SET ("X":10,"Y":10,"WIDTH":150,"HEIGHT":25,"TITLE":" Quit ","SYSTEM MENU":"Quit")
  20. 200   ON EVENT @Label,"SYSTEM MENU" GOTO Finis
  21. 210   !
  22. 220   !  Run the widgets for the engine monitor
  23. 230   !
  24. 240   Value=50
  25. 250   Siz=15
  26. 260 Loop_val: !
  27. 270   FOR I=1 TO 10000
  28. 280      !
  29. 290     IF Value<25 OR Value>=85 THEN Value=50
  30. 300     Torq=INT(Value+Siz*RND)
  31. 310     Pres=INT(Value+Siz*RND)
  32. 320     Dwell=INT(Value+Siz*RND)
  33. 330     Value=INT(Value+Siz*(RND-.5))
  34. 340      !
  35. 350     CONTROL @Meter1;SET ("VALUE":Torq)
  36. 360     CONTROL @Bars1;SET ("VALUE":Pres)
  37. 370     CONTROL @Dispdwell;SET ("VALUE":Dwell)
  38. 380     OUTPUT Buf$ USING "#,K,DDDD,X,DDD,DDD,DDD";"Update #";I,Torq,Pres,Dwell
  39. 390     CONTROL @Logtext;SET ("APPEND TEXT":Buf$)
  40. 400   NEXT I
  41. 410   GOTO Loop_val
  42. 420   !
  43. 430   STOP
  44. 440 Finis: END
  45.